package com.caigp.cookbook2.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.caigp.cookbook2.R;
import com.caigp.cookbook2.bean.CookBook;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import java.util.List;


public class ListAdapter extends BaseQuickAdapter<CookBook, BaseViewHolder> {

    public ListAdapter(int layoutResId, @Nullable List<CookBook> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, CookBook item) {
        helper.setText(R.id.name, item.getName());
        helper.setText(R.id.tag, item.getTag());
        helper.setText(R.id.preparetime, "准备：" + item.getPreparetime());
        helper.setText(R.id.cookingtime, "烹饪：" + item.getCookingtime());
        Glide.with(mContext).load(item.getPic()).placeholder(R.drawable.load).error(R.drawable.error).into((RoundedImageView) helper.getView(R.id.round_image));
    }
}
